﻿@using www.Controllers
@using www.SService
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}
@Html.ActionLink("Thêm mới", "Add", "Story")
<div class="clear"></div>

<div class="row">

    @using (Html.BeginForm("Index", "Story", FormMethod.Post, new { id = "frmLoadData" }))
    {
        <div class="left">
            <div class="col-left">Thể loại</div>
            <div class="col-right">
                @Html.DropDownList("Types", null, new { onchange = "frmLoadData.submit();", @class = "combobox" })
            </div>
        </div>
        <div class="right">
            <div class="col-left">Danh mục</div>
            <div class="col-right">
                @Html.DropDownList("Category", null, new { onchange = "frmLoadData.submit();", @class = "combobox" })
            </div>
        </div>
    }
</div>

<fieldset>
    <legend>Danh sách</legend>
    <div class="clear"></div>
    <table style="width: 100%; height: auto; border: 1px solid #008080;" cellpadding="1" cellspacing="1">
        @if (ViewData["Data"] != null)
        {
            <tr style="background: #0000cd; color: #fff; height: 30px; font-size: 13px; font-weight: bold; text-align: center;">
                <th style="width: 15%;">Tiêu đề </th>
                <th style="width: 10%;">Hình ảnh</th>
                <th style="width: 14%;">Liên kết</th>
                <th style="width: 6%;">Kiểu liên kết</th>
                <th style="width: 13%;">Thứ tự UT</th>
                <th style="width: 10%;">Ngày đăng</th>
                <th style="width: 6%;">Mặc định</th>
                <th style="width: 10%;">Trạng thái</th>
                <th style="width: 13%;">Thao tác</th>
            </tr>
            foreach (var item in (List<RelaxStoryDataContract>)ViewData["Data"])
            {
            <tr>
                <td>@item.Name</td>
                <td>
                    <img src="@item.Image" style="width: 120px; height: 70px;"/></td>
                <td>@item.Link</td>
                <td>@item.Target</td>
                <td>@item.Priority</td>
                <td>@item.Date.ToShortDateString()</td>
                <td>@item.IsDefault</td>
                <td>@Utility.Active(item.Active)</td>
                <td>@Html.ActionLink("Sửa", "Edit", new { id = item.Id }) | @Html.ActionLink("Xóa", "Delete", new { id = item.Id }, new { onclick = "return confirmDelete();" }) | @Html.ActionLink("Chi tiết", "Detail", new { id = item.Id })</td>
            </tr>
            }
        }

    </table>
</fieldset>
